<?php
/*! \brief
 * This is WFObject class
 * Manipulate all the string handle
 * \author William Su
 */
class WFObject
{
    /**
     * @var WF
     */
    protected $objFramework;
    public function __construct($objFramework){
        $this->objFramework = $objFramework;
    }
    /**
     *\brief Description
     * - This method will convert object to assocData
     * @return array
     */
    public function convertObject2Array($object){
        $return = null;
        if(is_array($object)){
            foreach($object as $key => $value){
                $return[$key] = $this->convertObject2Array($value);
            }
        }else{
            $objVars = '';
            if(is_object($object)){
                $objVars = get_object_vars($object);
            }
            if($objVars){
                foreach($objVars as $key => $value){
                    if($key && !$value && '0' !== $value){ //if $value is empty
                        $return[$key] = null;
                    }else{ //if $value is object
                        $return[$key] = $this->convertObject2Array($value);
                    }
                }
            }else{
                return (string)$object;
            }
        }
        return $return;
    }
}